package net.oschina.app.previousTest;

import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.robotium.solo.Solo;

import net.oschina.app.AppStart;

/**
 * Created by Administrator on 2017/6/30.
 */

public class TestTest extends ActivityInstrumentationTestCase2 {

    private Solo solo;

    public TestTest() {
        super(AppStart.class);
    }

    @Override
    public void setUp() throws Exception {
        super.setUp();
        solo = new Solo(getInstrumentation(), getActivity());
    }

    public void testName() throws Exception {
        //通过文本 定位 文本框
        TextView tab = solo.getText("博客");
        //如果能成功定位到，说明成功定位到这个控件
        solo.clickOnView(tab);
        solo.sleep(4000);
        //通过文本 定位 按钮控件
        Button button = solo.getButton("XXXX");
        String wenben = button.getText().toString();
        solo.sleep(2000);
    }

    @Override
    public void tearDown() throws Exception {
        solo.finishOpenedActivities();
        super.tearDown();
    }
}
